package com.spddr.pmos.rpt.pojo;

import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

import com.google.common.collect.Table;
import com.google.common.collect.TreeBasedTable;

public class PivotTable<R, C> {
	private final Map<R, String> rows;
	private final Map<C, String> cols;
	private final Table<R, C, Number> values;

	public PivotTable(Table<R, C, Number> values) {
		this.rows = new TreeMap<>();
		this.cols = new TreeMap<>();
		this.values = values;
	}

	public PivotTable(Comparator<R> rowComparator, Comparator<C> columnComparator) {
		this.rows = new TreeMap<>(rowComparator);
		this.cols = new TreeMap<>(columnComparator);
		this.values = TreeBasedTable.create(rowComparator, columnComparator);
	}

	public Map<R, String> getRows() {
		return rows;
	}

	public Map<C, String> getCols() {
		return cols;
	}

	public Table<R, C, Number> getValues() {
		return values;
	}
}
